
import json

from utils.mqtt_utils import send_mqtt_message, publish_message_to_redis

from settings import MQTT_TOPIC

if __name__ == '__main__':

    # Send a test message to MQTT

    print("Sending test message to MQTT by send_mqtt_message() function.")
    message_json = {"type": "test_message", "data": {"device_code": "1234567890", "message": "Hello, World!"}}
    send_mqtt_message(MQTT_TOPIC, json.dumps(message_json))

    print("Sent test message to MQTT by send_mqtt_message() function.")
    # Publish a test message to Redis
    message_json = {"type": "test_message", "data": {"device_code": "1234567890", "message": "send to redis"}}
    publish_message_to_redis(MQTT_TOPIC, json.dumps(message_json))